package ${packageName}.controller;

import ${packageName}.service.I${className}Service;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ${packageName}.entity.${className};
import ${packageName}.bo.${lowerClassName}.dto.input.${className}InputDto;
import ${packageName}.bo.${lowerClassName}.dto.query.${className}QueryDto;
import ${packageName}.bo.${lowerClassName}.vo.${className}Vo;
import java.util.*;
import ${basePackageName}.common.vo.CommonResultVo;

@Api(tags = "${remark}接口")
@RestController
@RequestMapping("/${lowerClassName}")

public class ${className}Controller {

    @Autowired
    private I${className}Service ${lowerClassName}Service;

    /**
     * 新增修改${remark}
     * @return
     */
    @RequestMapping("/saveOrUpdate")
    @ApiOperation(value = "新增${remark}", httpMethod = "POST", notes = "新增${remark}", code = 200)
    @ApiResponses({ @ApiResponse(code = 200, message = "新增${remark}成功")})
    public CommonResultVo save(@ModelAttribute ${saveClassName} ${lowerSaveClassName}){
        ${className} ${lowerClassName}= ${lowerClassName}Service.saveOrUpdate(${lowerSaveClassName});
        return CommonResultVo.success(null);
    }



    /**
     * 删除${remark}
     * @return
     */
    @RequestMapping("/delete")
    @ApiOperation(value = "删除${remark}", httpMethod = "POST", notes = "删除${remark}", code = 200)
    @ApiResponses({ @ApiResponse(code = 200, message = "删除${remark}成功") })
    public CommonResultVo delete(${primaryClassType} ${primaryClassName}){
        ${lowerClassName}Service.deleteByPrimary(${primaryClassName});
        return  CommonResultVo.success(null);
    }


    /**
     * 获取${remark}
     * @return
     */
    @RequestMapping("/get")
    @ApiOperation(value = "获取${remark}", httpMethod = "POST", notes = "获取${remark}", code = 200)
    @ApiResponses({ @ApiResponse(code = 200, message = "获取${remark}成功") })
    public CommonResultVo<${className}Vo> get(${primaryClassType} ${primaryClassName}){
        ${className}Vo ${lowerClassName}Vo=${lowerClassName}Service.getVoByPrimary(${primaryClassName});
        return  CommonResultVo.success(${lowerClassName}Vo);
    }

    /**
     * 获取${remark}分页
     * @param ${lowerClassSearchName} 查询参数对象
     * @return
     */
    @RequestMapping("/getPage")
    @ApiOperation(value = "获取${remark}分页列表", httpMethod = "POST", notes = "获取${remark}分页列表", code = 200)
    @ApiResponses({ @ApiResponse(code = 200, message = "获取${remark}分页列表成功") })
    public  CommonResultVo queryPage(@ModelAttribute ${classSearchName} ${lowerClassSearchName}){
        return CommonResultVo.success(${lowerClassName}Service.getPage(${lowerClassSearchName}));
    }



}
